-
Notifications
You must be signed in to change notification settings - Fork 792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cherry pick ot_certs changes #20915
Merged
pamaury
merged 9 commits into
lowRISC:earlgrey_es_sival
from
pamaury:ot_certs-cherry-pick
Jan 23, 2024
Merged
Cherry pick ot_certs changes #20915
pamaury
merged 9 commits into
lowRISC:earlgrey_es_sival
from
pamaury:ot_certs-cherry-pick
Jan 23, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This data can be used to exercise every piece of code that works with data, such as asn1 der generator and the asn1 codegen. More generally it can be used to create random certificates for testing. At the moment it generates random data but this could be extended to generate edges cases as well. Signed-off-by: Amaury Pouly <[email protected]>
Due to the hashmap using a nondeterministic order, it could differ between runs. Sort the entries to make sure this does not happen. Signed-off-by: Amaury Pouly <[email protected]>
The generator now output C++ unittest, those are compiled and turned into a bazel test by the bazek certificate macro. Signed-off-by: Amaury Pouly <[email protected]>
The code currently always allocates 3 bytes for the length and then moves the data forward if we need less bytes than requires. This works but means that the code could throw a kErrorAsn1BufferExhausted when producing a document even though the final encoding would actually fit into the buffer. This commit changes the behaviour so that the code now allocates only 1 byte for the length initially and moves the data backwards on finish if necessary. This guarantees that if the final document fits in the buffer, then the code will successfully produces it. This requires a bit of shuffling around in the code. It also requires a bit more care to avoid an accidental buffer overflow when moving the data. There is a unittest to specifically test corner cases in the moving code to make sure we never write past the end of the buffer. Signed-off-by: Amaury Pouly <[email protected]>
The code was double counting in some code path. Also the code was under-estimating the size of unsigned integers due to a quirk of ASN1 integer encoding that might require a padding with a 0x00 byte. Signed-off-by: Amaury Pouly <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
Signed-off-by: Amaury Pouly <[email protected]>
timothytrippel
approved these changes
Jan 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.